﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace giaodien
{
    public class dichchuyen
    {
        public static int DiChuyen, X, Y;
        static public void Exit(Form frm)
        {
            DialogResult ok = MessageBox.Show("Bạn muốn thoát", "Thong báo", MessageBoxButtons.OKCancel);
            if (ok == DialogResult.OK)
                frm.Dispose();
        }
        public static void Mini(Form frm)
        {
            frm.WindowState = FormWindowState.Minimized;
        }
        public static void MouseDown(MouseEventArgs e)
        {
            DiChuyen = 1;
            X = e.X;
            Y = e.Y;
        }
        public static void MouseUp()
        {
            DiChuyen = 0;
        }
        public static void MouseMove(Form frm, int X0, int Y0)
        {
            if (DiChuyen == 1)
            {
                frm.SetDesktopLocation(X0 - X, Y0 - Y);
            }
        }
    }
}
